﻿@using si.caha.Model;
@using si.caha.Repository;

@{
    Layout = "/tpl/_layout.cshtml";
    PageData["PageTitle"] = "Edit item";

    Item item = new Item();
    var dataContext = new DataContext();
    var itemRepository = new ItemRepository(dataContext);

    if (UrlData[0].Length > 0)
    {
        var id = UrlData[0].IsInt() ? UrlData[0].AsInt() : 0;
        item = itemRepository.Get(id);
    }
}
@RenderPage("_form.cshtml", new {item = @item})